using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.IO;

using InfFront.UICore;

namespace InfFront.InfoSources.Base
{
    public abstract partial class GenericListInfoSource<ItemType> : AbstractListInfoSource
    {
        #region Private Variables
        private List<ItemType> list = null;
        #endregion

        #region Construction/Initialization
        public GenericListInfoSource()
        {
            Init();
        }

        public GenericListInfoSource(IContainer container)
        {
            container.Add(this);
            Init();
        }

        private void Init()
        {
            InitializeComponent();
        }
        #endregion

        public virtual List<ItemType> GetList()
        {
            return null;
        }

        protected new List<ItemType> List
        {
            get
            {
                if (list == null)
                    list = GetList();
                return list;
            }
        }

        protected sealed override System.Collections.IList GetInternalList()
        {
            return List;
        }
    }
}
